package org.pedia2.apps.demo.helloworld.client.model;

import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.gwt.user.client.rpc.IsSerializable;
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class City implements IsSerializable{

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String encodedKey;
	@Persistent
	private String name;
	@Persistent(mappedBy = "city")
	private List<Taxi> taxiList;

	public City(){}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setTaxiList(List<Taxi> taxiList) {
		this.taxiList = taxiList;
	}

	public List<Taxi> getTaxiList() {
		return taxiList;
	}

	public void addTaxiToTaxiList(Taxi taxi) {
		if (taxiList == null)
			taxiList = new ArrayList<Taxi>();
		taxiList.add(taxi);
	}

	public void setEncodedKey(String encodedKey) {
		this.encodedKey = encodedKey;
	}

	public String getEncodedKey() {
		return encodedKey;
	}
}
